package com.ruoyi.delivery.controller;

import com.ruoyi.delivery.domain.DelLogisticInfo;
import com.ruoyi.delivery.service.IDelLogisticInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/delivery/logisticInfo")
public class DelLogisticInfoController {

    @Autowired
    private IDelLogisticInfoService logisticInfoService;

    /**
     * 根据 deliveryOrderNo 获取当前物流信息
     * @param deliveryId 运单号
     * @return 当前物流信息
     */
    @RequestMapping
    public DelLogisticInfo getCurrentLogisticInfo(String deliveryId) {
        return logisticInfoService.getCurrentLogisticInfo(deliveryId);
    }

    /**
     * 根据 deliveryOrderNo 获取所有历史物流信息
     * @param deliveryId 运单号
     * @return 所有历史物流信息
     */
    @RequestMapping("/history")
    public List<DelLogisticInfo> getAllLogisticDetailHistory(String deliveryId) {
        return logisticInfoService.getAllLogisticDetailHistory(deliveryId);
    }

    /**
     * 根据 vehicleNumber 获取所有历史物流信息
     * @param vehicleNumber 车牌号
     * @return 所有当前车牌的历史物流信息
     */
    @RequestMapping("/historyByVehicle")
    public List<DelLogisticInfo> getAllLogisticDetailHistoryByVehicle(String vehicleNumber) {
        return logisticInfoService.getAllLogisticDetailHistoryByVehicle(vehicleNumber);
    }
}